package com.voja.workoutrandomizer;

import org.json.JSONObject;

import com.voja.AndroidUtils.Application;
import com.voja.workoutrandomizer.repository.Workout;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;

public class OnWorkoutItemClick implements AdapterView.OnItemClickListener {
	
	Context context;
	
	public OnWorkoutItemClick(Context context) {
		this.context = context;
	}

	@Override
	public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
		Workout workout = (Workout)adapter.getItemAtPosition(position);
		
		Intent i = new Intent(context, Workouts.class);
		i.setAction(Intent.ACTION_VIEW);
		i.putExtra("workout", workout.getDefinition().toString());
		context.startActivity(i);
	}

}
